package com.pri.chat.activity;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

import com.netease.nim.uikit.net.SharedHelper;
import com.pri.chat.MainActivity;
import com.pri.chat.MainDaoHangActivity;
import com.pri.chat.R;
import com.pri.chat.application.APP;
import com.pri.chat.base.BaseActivity;
import com.pri.chat.base.SplashActivity;
import com.pri.chat.bean.KeyAndValueEntity;
import com.pri.chat.utils.statusbar.StatusBarUtil;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * 描述：添加类的描述
 *
 * @author
 * @time 2020/5/9
 */
public class OtherWishDhActivity extends AppCompatActivity {

    @BindView(R.id.wishMoney)
    TextView wishMoney; //////
    @BindView(R.id.jiaSuBtn)
    TextView jiaSuBtn;  //////
    @BindView(R.id.clickBtn1)
    TextView clickBtn1;   /////
    @BindView(R.id.tv_wish_age)
    TextView tv_wish_age;
    @BindView(R.id.vip_bg)
    TextView vip_bg;
    @BindView(R.id.vip_super_bg)
    TextView vip_super_bg;


    @BindView(R.id.view11)
    View view11;
    @BindView(R.id.view12)
    View view12;
    @BindView(R.id.viewLinear)
    View viewLinear;

    @BindView(R.id.jiaSuBtn1)
    TextView jiaSuBtn1;

    @BindView(R.id.shouzhiImg)
    View shouzhiImg;
    @BindView(R.id.nrTv)
    TextView nrTv;







    public Activity activity;
    public Context mContext;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(getLayoutId());
        activity = this;
        mContext = this;
        StatusBarUtil.setStatusBar(this,true,0,false,true);
        ButterKnife.bind(this);

        initView();
        initData();
    }

    protected int getLayoutId() {
        return R.layout.activity_my_wish_dh_layout;
    }

    protected void initView() {
        setTitle("愿望");
        vip_bg.setText("VIP");
        vip_super_bg.setText("SVIP");
        tv_wish_age.setText("19");
        view11.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

            }
        });
        view12.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

            }
        });
        viewLinear.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

            }
        });
    }

    protected void initData() {
        clickBtn1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if("完成".equals(clickBtn1.getText().toString())){
                    KeyAndValueEntity ky = new KeyAndValueEntity();
                    ky.setTypeKey("daohang");
                    ky.setValue("hasDone");
                    APP.getKeyAndValueEntityDao().save(ky);
                    Intent intent = new Intent(mContext, MainActivity.class);
                    intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
                    startActivity(intent);
                    finish();
                }else{
                    wishMoney.setText("¥30.40元");
                    jiaSuBtn.setBackgroundResource(R.drawable.btn_gray_20_shape);
                    viewLinear.setVisibility(View.GONE);
                    shouzhiImg.setVisibility(View.GONE);
                    nrTv.setText("快去互相加速吧");
                    clickBtn1.setText("完成");
                }
            }
        });
        jiaSuBtn1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                wishMoney.setText("¥30.40元");
                jiaSuBtn.setBackgroundResource(R.drawable.btn_gray_20_shape);
                viewLinear.setVisibility(View.GONE);
                shouzhiImg.setVisibility(View.GONE);
                nrTv.setText("快去互相加速吧");
                clickBtn1.setText("完成");
            }
        });

    }
}
